package com.fulihui.common.builder.web;


import com.fulihui.common.result.web.Result;

/**
 * 用户web端返回对象构建
 *
 * @author: Levon
 * @version: v 0.1 2018-06-08 11:09
 */
public class JsonResultBuilder {

    public static <T> Result<T> succ(T info) {
        Result<T> jsonResult = new Result<>();
        jsonResult.setSuccess(true);
        jsonResult.setInfo(info);
        return jsonResult;
    }

    public static Result succ() {
        Result jsonResult = new Result();
        jsonResult.setSuccess(true);
        return jsonResult;
    }

    public static <T> Result<T> fail(int errCode, String errMsg) {
        Result<T> jsonResult = new Result<>();
        jsonResult.setSuccess(false);
        jsonResult.setCode(errCode);
        jsonResult.setMessage(errMsg);
        return jsonResult;
    }

}
